package com.example.time;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author hej
 * @date 2023/6/27 13:41
 */
public class DateTest4 {
    public static void main(String[] args) {
        System.out.println(getSysdate());
    }
    public static String getSysdate() {
        long time = System.currentTimeMillis();
        Date date = new Date(time);
        //定义时间的格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String strTime = sdf.format(date);
        return strTime;
    }
}
